package com.model;

import java.util.List;

import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Model;
import com.jfinal.plugin.activerecord.Page;

public class Stu_chose_Tch extends Model<Stu_chose_Tch>{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	public final static Stu_chose_Tch dao = new Stu_chose_Tch();
	
	public List<Stu_chose_Tch> Stu_Tch()
	{
		List<Stu_chose_Tch> stu_tch=null;
		String sql="select * from stu_chose_tch";
		stu_tch=Stu_chose_Tch.dao.find(sql);
		return stu_tch;
	}
	
	/**
	 * 返回还没有指导老师的学生列表
	 * @param departmentId
	 * @return
	 */
	public List<Stu_chose_Tch> chose_stu(int departmentId)
	{
		List<Stu_chose_Tch> stuList;
		String sql="select * from stu_chose_tch WHERE teacher_id IS NULL and student_department='"+departmentId+"' order by student_id asc";
		stuList = Stu_chose_Tch.dao.find(sql);
		return stuList;
	}
	
	/**
	 * 返回还没有指导老师的学生列页
	 * @param pageNumber
	 * @param pageSize
	 * @param departmentId
	 * @return
	 */
	public Page<Stu_chose_Tch> chose_stu(int pageNumber, int pageSize, int departmentId) 
	{
		return paginate(pageNumber, pageSize, "select *", "from stu_chose_tch WHERE teacher_id IS NULL and student_department='"+departmentId+"' order by student_id asc");
	}
	
	public List<Integer> tchChose(int departmentId)
	{
		int num=0;
		String sql="SELECT student_id FROM stu_chose_tch WHERE teacher_id IS NULL and student_department='"+departmentId+"'";
		List<Integer> stuIdList= Db.query(sql);
		return stuIdList;	
	}
}
